package me.leiusual.sharing.ui.store

import androidx.lifecycle.ViewModel
import dagger.Binds
import dagger.Module
import dagger.android.ContributesAndroidInjector
import dagger.multibindings.IntoMap
import me.leiusual.sharing.di.FragmentScope
import me.leiusual.sharing.di.ViewModelKey
import me.leiusual.sharing.ui.store.dialog.StoreCategoryDialog
import me.leiusual.sharing.ui.store.dialog.StoreCategoryViewModel

/**
 * Create by leiusual on 2018/8/14
 */
@Module
abstract class StoreModule {

  @FragmentScope
  @ContributesAndroidInjector
  abstract fun storeCategoryDialog(): StoreCategoryDialog

  @Binds
  @IntoMap
  @ViewModelKey(StoreCategoryViewModel::class)
  abstract fun storeCategoryViewModel(storeCategoryViewModel: StoreCategoryViewModel): ViewModel

  @FragmentScope
  @ContributesAndroidInjector
  abstract fun storeAreaFragment(): StoreAreaFragment

  @Binds
  @IntoMap
  @ViewModelKey(StoreAreaViewModel::class)
  abstract fun storeAreaViewModel(storeAreaViewModel: StoreAreaViewModel): ViewModel

  @FragmentScope
  @ContributesAndroidInjector
  abstract fun storeDetailFragment(): StoreDetailFragment

  @Binds
  @IntoMap
  @ViewModelKey(StoreDetailViewModel::class)
  abstract fun storeDetailViewModel(storeDetailViewModel: StoreDetailViewModel): ViewModel

  @FragmentScope
  @ContributesAndroidInjector
  abstract fun storeHomeFragment(): StoreHomeFragment

  @Binds
  @IntoMap
  @ViewModelKey(StoreHomeViewModel::class)
  abstract fun storeHomeViewModel(storeHomeViewModel: StoreHomeViewModel): ViewModel
}